﻿/**
作者：高彩红
时间：209-12-4
功能：实现互动交流信息回复
**/
var Obj = new Object();
var id = "";
function ShowMain() {
    GetXinxi();
}
//获取“信息”
function GetXinxi() {
    if (id==""){
        id=request("id");
    }
    var url = encodeURI(SBasePath + '/action/Hdjl/GetHdjl.aspx');
    var pars = encodeURI("?id=" + id);
    var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: sGetXinxi, onFailure: fGetXinxi });
}
function sGetXinxi(o) {
    Obj = MapHdjl(o);
    ShowEdit();
}
function fGetXinxi() {
}

//提交
function sbmt() {
    if (CheckForm()) {
        var url = encodeURI(SBasePath + '/action/Hdjl/HdjlEdit.aspx');
        var myAjax = new Ajax.Request(url, { method: 'post', parameters: Form.serialize("formsubmit"), onComplete: sFormSubmit, onFailure: fFormSubmit });
    }
};

//提交成功
var sFormSubmit = function(o) {
    var root = o.responseXML.documentElement;
    var OutputFlag = GetXmlData(root, "Value");
    var alt = GetXmlData(root, "Alt");
    if (OutputFlag == "true") {
        MsgDlgLocal(alt);
    }
    else {
        MsgDlg(alt);
        window.history(-1);
    }

};
//提交失败
var fFormSubmit = function(o) {
};


var CheckForm = function() {

    var fobj = $("formsubmit");

    if (Trim(fobj.Contents.value) == "") {
        $("Contentsdiv").style.display = "";
        return false;
    }
    else {
        $("Contentsdiv").style.display = "none";
    }
    return true;
};

function ShowEdit() {
    var str = "";
    str += '<form id="formsubmit">';
    str += '<input type="hidden" name="hidId" value="' + Obj.ID + '"/>';
    str += '<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">';
    str += '<tr>';
    str += '    <td height="30">';
    str += '        <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '            <tr>';
    str += '                <td width="15" height="30" class="tab03">';
    str += '                </td>';
    str += '                <td class="tab05">';
    str += '                    <div class="title1" style="padding-top: 2px">';
    str += '                        <img src="../../img/1.gif" height="20" width="19" />互动交流信息回复</div>';
    str += '                </td>';
    str += '                <td width="14" class="tab07"></td>';
    str += '            </tr>';
    str += '        </table>';
    str += '    </td>';
    str += '</tr>';
    str += '<tr>';
    str += '    <td>';
    str += '        <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '            <tr>';
    str += '                <td width="9" class="tab12"></td>';
    str += '                <td bgcolor="#f3ffe3">';
    str += '                    <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '                        <tr>';
    str += '                            <td class="k_hui">';
    str += '                                <table width="97%" border="0" cellspacing="0" cellpadding="0" align="center">';
    str += '                                    <tr height="38">';
    str += '                                        <td height="30" width="12%" style="padding-left: 5px">';
    str += '                                            内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容：';
    str += '                                        </td>';
    str += '                                        <td widht="25%">';
    str += '                                             <textarea name="UserContents" id="UserContents" cols="50" rows="11" style="height: 100px; width: 250px; border: solid 1px #cadcb2;">' + Obj.UserContents + '</textarea>';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                        </td>';
    str += '                                    </tr>';
    str += '                                    <tr height="38">';
    str += '                                        <td height="30" width="12%" style="padding-left: 5px">';
    str += '                                            提&nbsp;&nbsp;交&nbsp;&nbsp;人：';
    str += '                                        </td>';
    str += '                                        <td width="25%">';
    str += '                                            <input type="text" readonly name="UserName" id="UserName" class="wbk" value="' + Obj.UserName + '" />';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                        </td>';
    str += '                                    </tr>';
    str += '                                    <tr height="38">';
    str += '                                        <td height="30" width="12%" style="padding-left: 5px">';
    str += '                                            联系方式：';
    str += '                                        </td>';
    str += '                                        <td widht="25%">';
    str += '                                            <input type="text" readonly name="UserTel" id="UserTel" class="wbk"  value="' + Obj.UserTel + '"/>';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                        </td>';
    str += '                                    </tr>';
    str += '                                    <tr height="38">';
    str += '                                        <td height="30" width="12%" style="padding-left: 5px">';
    str += '                                            部&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;门：';
    str += '                                        </td>';
    str += '                                        <td widht="25%">';
    str += '                                            <input type="text" readonly name="UserDept" id="UserDept" class="wbk" value="' + Obj.UserDept + '"/>';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                        </td>';
    str += '                                   </tr>';
    str += '                                    <tr height="38">';
    str += '                                        <td height="30" width="12%" style="padding-left: 5px">';
    str += '                                            提交时间：';
    str += '                                        </td>';
    str += '                                        <td widht="25%">';
    str += '                                            <input type="text" readonly name="SendTime" value=' + Obj.SendTime + ' id="SendTime" class="wbk" />';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                        </td>';
    str += '                                   </tr>';
    str += '                                    <tr height="38">';
    str += '                                        <td height="30" width="12%" style="padding-left: 5px">';
    str += '                                            回复时间：';
    str += '                                        </td>';
    str += '                                        <td widht="25%">';
    str += '                                            <input type="text" readonly name="SendTime" value=' + Obj.AnswerTime + ' id="SendTime" class="wbk" />';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                        </td>';
    str += '                                   </tr>';
    str += '                                    <tr height="38">';
    str += '                                        <td height="30" width="12%" style="padding-left: 5px">';
    str += '                                            回复内容：';
    str += '                                        </td>';
    str += '                                        <td widht="25%">';
    str += '                                            <textarea name="Contents" id="Contents" cols="50" rows="11" style="height: 100px; width: 250px; border: solid 1px #cadcb2;">' + Obj.Contents + '</textarea>';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                            <div alght="right" class="clew" id="Contentsdiv" style="display:none">';
    str += '                                                <img src="../../images/lamp.gif" width="15" height="16" align="absmiddle" />请填写回复内容！</div>';
    str += '                                        </td>';
    str += '                                    </tr>';
    str += '                                    <tr height="38">';
    str += '                                        <td colspan="2" style="padding-left: 25px" height="30">';
    str += '                                             <input name="提交" type="button" class="bg_g" style="height: 22px; width: 60px; border: solid 1px #cadcb2;"value="提交" onclick="sbmt()" />';
    str += '                                            &nbsp;&nbsp;<input name="重置" type="reset" class="bg_g" style="height: 22px; width: 60px;border: solid 1px #cadcb2;" value="重置" />';
    str += '                                        </td>';
    str += '                                        <td width="52%" class="zw">';
    str += '                                        </td>';
    str += '                                    </tr>';
    str += '                                </table>';
    str += '                             </td>';
    str += '                        </tr>';
    str += '                    </table>';
    str += '                </td>';
    str += '                <td width="9" class="tab16">';
    str += '                </td>';
    str += '            </tr>';
    str += '        </table>';
    str += '    </td>';
    str += '</tr>';
    str += '<tr>';
    str += '    <td height="29">';
    str += '        <table width="100%" border="0" cellspacing="0" cellpadding="0">';
    str += '            <tr>';
    str += '                <td width="15" height="29" class="tab20">';
    str += '                </td>';
    str += '                <td class="tab21">';
    str += '                    &nbsp;';
    str += '                </td>';
    str += '                <td width="14" class="tab22">';
    str += '                </td>';
    str += '            </tr>';
    str += '        </table>';
    str += '    </td>';
    str += '</tr>';
    str += '</table>';
    str += '</form>';
    $("HdjlList").innerHTML = str;
}